﻿using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
using System.Data.Entity.Migrations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Timetable.Data.Context;
using Timetable.Data.Migrations;

namespace Timetable.Proxy
{
    public static class DatabaseConfig
    {
        public static void Initialize(string dbContextName)
        {
            Database.SetInitializer(new MigrateDatabaseToLatestVersion<DataContext, Configuration>());

            //var config = new Configuration { TargetDatabase = new DbConnectionInfo(dbContextName) };
            //var migrator = new DbMigrator(config);

            //migrator.GetPendingMigrations();

            //if(!Database.Exists(dbContextName))
            //{
            //    migrator.Update("FillDatabase");
            //} 
            
            //migrator.Update();
        }
    }
}
